//
//  SNMyArtelAssociatorSectionHeaderView.m
//  ZhuoxinAgriculture
//
//  Created by stone on 16/12/17.
//  Copyright © 2016年 stone. All rights reserved.
//

#import "SNMyArtelAssociatorSectionHeaderView.h"
#import "Masonry.h"
@interface SNMyArtelAssociatorSectionHeaderView()
/** titleLabel */
@property (weak, nonatomic) UILabel * titleLabel;
/** splitLineView */
@property (weak, nonatomic) UIView * splitLineView;
/** View */
@property (weak, nonatomic) UIView * topView;
@end
@implementation SNMyArtelAssociatorSectionHeaderView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addViews];
        [self setupUI];

    }
    return self;
}

- (void)addViews
{
    
    UIView * topView = ({
        UIView * view = [[UIView alloc] init];
        
        view.backgroundColor = HexRGB(0xf5f5f5);
        
        [self addSubview:view];
        
        view;
    });
    self.topView = topView;
    
    UILabel * titleLabel = ({
        UILabel * label = [[UILabel alloc] init];
        /** GPU 优化 */
//        label.opaque = YES;
//        label.backgroundColor = [UIColor whiteColor];
//        label.layer.masksToBounds = YES;
        //------------------------------
        label.numberOfLines = 0;
        label.textColor = [UIColor blackColor];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"组织成员";
        label.font = [UIFont systemFontOfSize:15];
        
         [self addSubview:label];

        label;
    });
    self.titleLabel = titleLabel;
    
    UILabel * countLabel = ({
        UILabel * label = [[UILabel alloc] init];
        /** GPU 优化 */
//        label.opaque = YES;
//        label.backgroundColor = [UIColor whiteColor];
//        label.layer.masksToBounds = YES;
        //------------------------------
        label.numberOfLines = 0;
        label.textColor = HexRGB(0x67B245);
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"8个";
        label.font = [UIFont systemFontOfSize:15];
        
        [self addSubview:label];
        
        label;
    });
    self.countLabel = countLabel;
    

    
    UIView * splitLineView = ({
        UIView * view = [[UIView alloc] init];
        
        view.backgroundColor = HexRGB(0xE2E2E2);
        
         [self addSubview:view];
        
        view;
    });
    self.splitLineView = splitLineView;
}
- (void)setupUI
{
    
    [self.topView mas_makeConstraints:^(MASConstraintMaker * make) {
        make.left.mas_equalTo(self.mas_left).offset(0);
        make.right.mas_equalTo(self.mas_right).offset(0);
        make.top.mas_equalTo(self.mas_top).offset(0);
        make.height.mas_equalTo(10);
    }];

    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker * make) {
        make.left.mas_equalTo(self.mas_left).offset(21);
        make.centerY.mas_equalTo(self.mas_centerY).offset(5);
    }];
    
    [self.countLabel mas_makeConstraints:^(MASConstraintMaker * make) {
        make.left.mas_equalTo(self.titleLabel.mas_right).offset(34);
        make.centerY.mas_equalTo(self.mas_centerY).offset(5);
    }];
    
    [self.splitLineView mas_makeConstraints:^(MASConstraintMaker * make) {
        make.left.mas_equalTo(self.mas_left).offset(0);
        make.right.mas_equalTo(self.mas_right).offset(0);
        make.bottom.mas_equalTo(self.mas_bottom).offset(0);
        make.height.mas_equalTo(1);
    }];

}
@end
